package com.syh.jn.scm.domain.supplier.repository.sale;

import cn.redscarf.commons.wrapper.Wrapper;
import com.syh.core.ddd.infrastructure.repository.ReadRepo;
import com.syh.jn.scm.domain.supplier.entity.sale.SaleOrder;
import com.syh.jn.scm.domain.supplier.entity.sale.SaleOrderItem;
import com.syh.jn.scm.dto.supplier.sale.SaleStatisticalAmountVo;

import java.util.List;

/**
 * Date:2018/7/16
 * Author:Clown
 * Desc;
 */
public interface SaleOrderReadRepository extends ReadRepo<SaleOrder, Long> {
    boolean saleItemExistsById(String column, Long id);

    /**
     * 销售统计金额
     *
     * @param wrapper
     * @return
     */
  <T> T statisticalAmount(Wrapper wrapper);

  <T> T statisticalAmountByOrder(Wrapper we);

  <T> List<T> statisticalAmountByCustomer(Wrapper we);

  <T> List<T> getItemsBySaleOrderId(Long saleOrderId);


  /**
   * 根据所属ids查找明细
   * @param saleOrderIds
   * @return
   */
  <T> List<T> getItemsBySaleOrderIds(Long[] saleOrderIds);

  /**
   * 根据商品id拿到明细商品
   * @param goodsId
   * @return
   */
  <T> T getByGoodsId(Long goodsId, Long id);


  <T> T getItemByItemId(Long id);    List<SaleStatisticalAmountVo> statisticalAmountByGoods(Wrapper we);

}
